<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script src="js/rem.js"></script>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="css/reset.css"/>
		<link rel="stylesheet" href="css/common.css" />
		<link rel="stylesheet" type="text/css" href="css/reg.css"/>
	</head>
	<body>
		<header>足球圈子-注册</header>
		<div class="form">
			<input type="text" name="" id="tell" placeholder="手机号"/>
			<input type="password" name="" id="pass" placeholder="密码"/>
			<input type="text" name="" id="nicheng" placeholder="昵称"/>
			<button id="btn">
				提 交
			</button>
		</div>
	</body>
	<script type="text/javascript" src="js/jquery-1.11.0.js"></script>
	<script type="text/javascript">
		$(function(){
			
			$("#btn").click(function(){
				var tell = $("#tell").val(),
			    	pass = $("#pass").val(),
			   		nicheng = $("#nicheng").val();
			   		var reg = /^1[0-9]{10}$/; //  11 位的手机号
			   		var reg1 = /^[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,14}$/  // 6-14 位的密码;
			   		if(reg.test(tell) && reg1.test(pass)){
			   			$.ajax({
							type:"get",
							url:"http://localhost:8080/Proxy/FootBall/user/json/reg.do",
							data:{"loginname":tell,
							      "password":pass,
							      "nickname":nicheng},
							async:true,
							success:function(rsp){
								var rsp = JSON.parse(rsp);
                                if(rsp.ecode == 200){
                                	alert("注册成功");
                                	setTimeout(function(){
                                		window.location.href = "login.html";
                                	},1000);
                                }else{
                                	alert(rsp.errorinfo);
                                }
							}
						});
			   		}else{
			   			alert("注册失败");
			   		}
					
			   
			});
			
			
		})
	</script>
</html>
